package cz.boxdesign.library.entity.dao.query;

public enum PujcenoSqlQuery implements Query {
  UNKNOWN("", 0),

  SELECT("select * from pujceno where 1=1 ", Query.SELECT),
  UPDATE("update pujceno set pujceno_do = ? where id_u = ? and id_k = ?", Query.UPDATE),
  INSERT("insert into pujceno(id_k,id_u,pujceno_od,pujceno_do) values(?,?,?,?)", Query.INSERT),
  DELETE("delete from pujceno where id_u = ? and id_k = ?", Query.DELETE);

  private String query;
  private Integer value;

  private PujcenoSqlQuery(String query, Integer value) {
    this.query = query;
    this.value = value;
  }

  /* (non-Javadoc)
   * @see cz.boxdesign.library.common.dao.Queries#getQuery()
   */
  @Override
  public String getQuery() {
    return query;
  }

  /* (non-Javadoc)
   * @see cz.boxdesign.library.common.dao.Queries#getValue()
   */
  @Override
  public Integer getValue() {
    return value;
  }

  /**
   * @param value
   *          the status value
   * @return return status object by value or {@link #UNKNOWN} if not found
   */
  public static PujcenoSqlQuery getByValue(Integer value) {
    for (PujcenoSqlQuery mps : values()) {
      if (mps.getValue().equals(value)) {
        return mps;
      }
    }
    return UNKNOWN;
  }

}
